import { createStore } from "vuex";

// import user from "./modules/user";
// import app from "./modules/app";

const moduleFiles = import.meta.glob("./modules/*.js", {
  eager: true,
  import: "default",
});

// 遍历 moduleFiles 得到 modules
// console.log('moduleFiles', moduleFiles)
let modules = {};
for (let key in moduleFiles) {
  const arr = key.split("/");
  const name = arr[arr.length - 1].split(".")[0];
  modules[name] = moduleFiles[key];
}
// console.log('modules', modules)

const store = createStore({
  modules,
});

export default store;
